from django.utils.deprecation import MiddlewareMixin
from django.http import JsonResponse
import json

class CheckPremission(MiddlewareMixin):
    def process_request(self,request):
        # 一般添加的是post
        if request.path in ['app01/user/','/app01/depart/'] and request.method=='POST':
            dict=json.loads(request.body.decode())
            auth=str(dict.get('auth'))
            if auth=='0':
                return JsonResponse({'code':2000,'msg':'权限不够'})


        pass